package com.huawei.fastengine.fastview;

import android.content.Context;
import android.content.res.Configuration;
import android.util.Log;
import android.widget.FrameLayout;
import com.huawei.fastengine.internal.fastview.FastViewInstanceImpl;

public abstract class FastViewInstance {

    public static class FastViewInstanceBuilder {
        private String accessType;
        private ICardMessage iCardMessage;
        private Context mContext;
        private FastViewInstanceGroup mGroup;
        private JSBundleLoader mJSBundleLoader;
        private RenderListener mRenderListener;
        private int mWidth;

        public FastViewInstance build() {
            Log.i("FastSDKEngine", "FastViewInstance build");
            FastViewInstance fastViewInstanceImpl = new FastViewInstanceImpl(this.mContext, this.mJSBundleLoader, this.mRenderListener, this.iCardMessage, this.mWidth, this.accessType);
            if (this.mGroup != null) {
                this.mGroup.add(fastViewInstanceImpl);
            }
            return fastViewInstanceImpl;
        }

        public FastViewInstanceBuilder registerCardMessage(ICardMessage iCardMessage) {
            this.iCardMessage = iCardMessage;
            return this;
        }

        public FastViewInstanceBuilder setAccessType(String str) {
            this.accessType = str;
            return this;
        }

        public FastViewInstanceBuilder setContext(Context context) {
            this.mContext = context;
            return this;
        }

        public FastViewInstanceBuilder setGroup(FastViewInstanceGroup fastViewInstanceGroup) {
            this.mGroup = fastViewInstanceGroup;
            return this;
        }

        public FastViewInstanceBuilder setJSBundleLoader(JSBundleLoader jSBundleLoader) {
            this.mJSBundleLoader = jSBundleLoader;
            return this;
        }

        public FastViewInstanceBuilder setRenderListener(RenderListener renderListener) {
            this.mRenderListener = renderListener;
            return this;
        }

        public FastViewInstanceBuilder setViewWidth(int i) {
            this.mWidth = i;
            return this;
        }
    }

    public static FastViewInstanceBuilder builder() {
        return new FastViewInstanceBuilder();
    }

    public abstract void attachRootView(FrameLayout frameLayout);

    public abstract boolean onBack();

    public abstract void onConfigurationChanged(Configuration configuration);

    public abstract void onDestroy();

    public abstract void onPause();

    public abstract void onRequestPermissionsResult(int i, String[] strArr, int[] iArr);

    public abstract void onResume();

    public abstract void onStart();

    public abstract void onStop();

    public abstract void render(String str);

    public abstract void sendMessageToCard(String str);
}
